﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microhard.Permission.MVCFilter;
using Microhard.WarehouseInsp.Buz.Interfaces;
using Microhard.Core;

namespace Microhard.WarehouseInsp.WebUI.Areas.WarehouseInsp.Controllers
{
    public class SSOController : Controller
    {
        [MVCSSOFilter("key")]
        public ActionResult Index(string key)
        {
            return View();
        }

        [MVCSSOFilter("key", false)]
        public ActionResult File(string key, Guid fileID)
        {
            IFile file = IoC.Resolve<IFile>();
            var model = file.GetModelByID(fileID);
            return File(model.Content, "text/comma-separated-values", HttpUtility.UrlEncode(model.Name));
        }

    }
}
